package com.ssm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ssm.entity.Role;
import com.ssm.service.RoleServiceImpl;

@Controller
@RequestMapping("role")
public class RoleController {
	@Autowired
	private RoleServiceImpl roleService;
	
	@RequestMapping("/show")
	public String show(){		
		return "role :: content";
	}	
	
	@RequestMapping("/list")
	@ResponseBody
	public String index(){
        return roleService.findAll();
	}
	
	@RequestMapping("/add")
	@ResponseBody
	public String add(Role role){
        return roleService.add(role);
	}
	
	@RequestMapping("/get")
	@ResponseBody
	public String get(int rid){
        return roleService.get(rid);
	}
	
	@RequestMapping("/update")
	@ResponseBody
	public String update(Role role){
        return roleService.update(role);
	}
	
	@RequestMapping("/delete")
	@ResponseBody
	public String delete(int rid){
        return roleService.delete(rid);
	}
}
